<?php

/**
 * RegisterForm class.
 * RegisterForm is the data structure for keeping
 * user registration form data. It is used by the 'register' action of 'SiteController'.
 */
class RegisterForm extends CFormModel
{
    public $email;
    public $password;
    public $repeat_password;
    public $phone;

    private $_identity;

    /**
     * Declares the validation rules.
     * The rules state that username, password & email are required,
     * and username & email needs to be unique.
     */
    public function rules()
    {
        return array(
            // email and password are required
            array('email, password, repeat_password', 'required'),
            array('repeat_password', 'compare', 'compareAttribute'=>'password', 'message'=>"Password must be repeated exactly."),
            // make sure username and email are unique
            array('email', 'unique'),
        );
    }

    /**
     * Declares attribute labels.
     */
    public function attributeLabels()
    {
        return array(
            'email'=>'Email address',
            'password'=>'Password',
            'password'=>'Confirm Password',
            'phone'=>'Phone',
        );
    }
}